<form id="pagerForm" method="post" action="">
    <input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
</form>
<div class="pageHeader">
    <form rel="pagerForm" onsubmit="return navTabSearch(this);" action="{:U($module_name.'/'.$action_name)}" method="post">
        <div class="searchBar">
            <ul class="searchContent">
                <li style="width:210px;">
				<label style="width:60px;">关键字：</label><input type="text" class="autoinput" name="keywords" value="{$keywords}" style="width:120px;"/></li><li style="width:60px;">
                    <select name="sfield" class="combox">
                        <option value="all" {if $wherefields=='all'}selected="selected"{/if}>全部</option>                   
                        <option value="id" {if $wherefields=='id'}selected="selected"{/if}>ID</option>
						<option value="money_auth" {if $wherefields=='money_auth'}selected="selected"{/if}>授权号</option>
                        <option value="userid" {if $wherefields=='userid'}selected="selected"{/if}>操作用户</option>
                        <option value="aid" {if $wherefields=='aid'}selected="selected"{/if}>录入员</option>
                    </select>
                    <input type="hidden" name="sfield_name" value="money_auth,id,userid,aid" /></li>
					<li>
                    <select id="status" name="status">
                        <option value="">状态</option>
                        <option value="0"
                            <eq name="map['statu']" value="0" >
                                selected="selected"
                            </eq>>未使用
                        </option>
                        <option value="1"
                            <eq name="map['statu']" value="1" >
                                selected="selected"
                            </eq>>已使用
                        </option>
                    </select>
                </li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            检索
                        </button>
                    </div>
                </div>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="button" onclick="navTab.reload();">
                            刷新 
                        </button>
                    </div>
                </div>
            </ul>
        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="{:U('Kitmoney/cmoneyauth')}" target="dialog" width="600" height="300"><span>授权操作</span></a></li>
        </ul>
    </div>
    <div id="w_list_print">
        <table class="list" width="100%" targetType="navTab" layoutH="90">
            <thead>
            <tr>
                <th width="20" orderField="id" {if $orderField=='id'}class="{$orderDirection}"{/if}><input type="checkbox" group="ids[]" class="checkboxCtrl"></th><th width="40">ID</th>
				<th width="80" orderField="uid" {if $orderField=='aid'}class="{$orderDirection}"{/if}>录入员</th>  
                <th>授权码</th>
				<th>授权额度</th>
                <th width="160" orderField="ctime" {if $orderField=='ctime'}class="{$orderDirection}"{/if}>授权时间</th>
                <th width="160">使用时间</th>
                 <th width="40" orderField="uid" {if $orderField=='aid'}class="{$orderDirection}"{/if}>操作员</th>           
                <th width="100" orderField="userid" {if $orderField=='userid'}class="{$orderDirection}"{/if}>操作帐户</th>
				 <th width="60" orderField="statu" {if $orderField=='statu'}class="{$orderDirection}"{/if}>状态</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="list" id="vo" key="k">
            <php>
            $oedu=unserialize($vo['oedu']);
            $oedu['amount'] = $oedu['amount']/100;
			$oedu['give'] = $oedu['give']/100;
            $giveinfo = explode(':::',$vo['content']);
			//处理赠送BV
            if($giveinfo['1']){
				$bveachkey = strrpos($giveinfo['1'],':','-1')+1;
				$bveach = substr($giveinfo['1'],$bveachkey,strlen($giveinfo['1'])-$bveachkey);
	            $bvgive=str_replace(array('qishu','eachoedu',$bveach),array('分成','每期',floor($bveach/100)),$giveinfo['1']);		
            }
			
			//处理赠送CV
			if($giveinfo['2']){
				$cveachkey = strrpos($giveinfo['2'],':','-1')+1;
				$cveach = substr($giveinfo['2'],$cveachkey,strlen($giveinfo['2'])-$cveachkey);
				$cvgive= str_replace(array('cvqishu','cveachoedu',$cveach),array('分成','每期',floor($cveach/100)),$giveinfo['2']);
			}
			
			if(empty($giveinfo['1']) && empty($giveinfo['2'])){
           		 unset($giveinfo);
            }
            </php>
            <tr target="sid_dv" rel="{$vo['id']}">
                <td align="center"><input type="checkbox" name="ids[]" value="{$vo['id']}" /></td><td align="center">{$vo['id']}</td>
                <td> <a title="查看" target="dialog" width="580" height="500" rel="User_detail_{$vo['id']}" href="{:U('User/detail',array('id'=>$vo['aid']))}">{$vo['aid']}</a></td>
                <td>{$vo['money_auth']}</td>
				<td >
                    <empty name="giveinfo">
                        预付款XV：{$oedu['amount']} <!--赠送BV：{$oedu['give']}-->
						<else/> 预付款XV：{$oedu['amount']}{if $cvgive}(<a href="{:U('Give/index',array('keywords'=>$vo['money_auth'],'sfield'=>'auth','moneytype'=>'CV'))}" target="navTab" title="分期列表">{$cvgive}</a>){/if}  
						赠送BV：{$oedu['give']} {if $bvgive}(<a href="{:U('Give/index',array('keywords'=>$vo['money_auth'],'sfield'=>'auth','moneytype'=>'BV'))}" target="navTab" title="分期列表">{$bvgive}</a>){/if}
                    </empty>
                </td>
				
                <td>{$vo['ctime']|date='Y-m-d H:i:s',###}</td>
                <td align="center">
                    <if condition="$vo['mtime'] gt 0">
                    {$vo['mtime']|date='Y-m-d H:i:s',###}<else/>-
                    </if>
                </td>
				<td align="center"> 
				{if $vo['uid']}<a title="查看" target="dialog" width="580" height="500" rel="User_detail_{$vo['id']}" href="{:U('User/detail',array('id'=>$vo['uid']))}">{$vo['uid']}</a>{/if}
				</td>
            	
			   <td align="center">
			   	{if $vo['userid']}
				 <a title="查看" target="dialog" width="580" height="500" rel="User_detail_{$vo['id']}" href="{:U('User/detail',array('id'=>$vo['userid']))}">{$vo['userid']}</a>
				 {/if}
				 </td>
			    <td align="center">
                    <if condition="$vo['statu'] eq 1">
                    已使用<elseif condition="$vo['statu'] eq 0" /><font color='green'>可用</font><elseif condition="$vo['statu'] eq 3" />已作废
                    </if>
                </td>
                <td align="center"><a class="btnLook" href="{:U('Kitmoney/authview',array('id'=>$vo['id']))}" target="dialog" width="350" height="200" title="查看">查看</a>
                    <if condition="$vo['statu'] eq 0">
                    <a href="{:U('Kitmoney/statu',array(id=>$vo['id']))}" target="ajaxTodo" title='确定作废？' class="btnDel">作废</a>
                    </if>
                </td>
            </tr>
            </volist>
            </tbody>
        </table>
    </div>
    <include file="Index:pages" />
</div>